package de.pelizaeus.app;



import android.content.Intent;
import android.os.Bundle;
import android.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;


public class GebaeudeFragment extends Fragment implements View.OnClickListener {

    public final static String EXTRA_MESSAGE ="de.pelizaeus.app.GEBAEUDE_MESSAGE";
    private static final String TAG = "RaumplanActivity";

    public GebaeudeFragment() {
        // Required empty public constructor
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View rootView =  inflater.inflate(R.layout.fragment_gebaeude, container, false);
        Button button = null;
        button = (Button) rootView.findViewById(R.id.a_button);
        button.setOnClickListener(this);
        button = (Button) rootView.findViewById(R.id.b_button);
        button.setOnClickListener(this);
        button = (Button) rootView.findViewById(R.id.c_button);
        button.setOnClickListener(this);
        button = (Button) rootView.findViewById(R.id.k_button);
        button.setOnClickListener(this);
        button = (Button) rootView.findViewById(R.id.m_button);
        button.setOnClickListener(this);
        button = (Button) rootView.findViewById(R.id.s_button);
        button.setOnClickListener(this);
        return rootView;
    }

    public void onClick(View view) {
        Intent intent;
        switch (view.getId()) {
            case R.id.a_button:
                // A Gebäude
                intent = new Intent(getActivity(), RaumplanShowActivity.class);
                intent.putExtra(EXTRA_MESSAGE, 'a');
                startActivity(intent);
                break;
            case R.id.b_button:
                // B Gebäude
                Log.d(TAG, "Button B-Gebäude gedrückt!");
                intent = new Intent(getActivity(), RaumplanShowActivity.class);
                intent.putExtra(EXTRA_MESSAGE, 'b');
                startActivity(intent);
                break;
            case R.id.c_button:
                intent = new Intent(getActivity(), RaumplanShowActivity.class);
                intent.putExtra(EXTRA_MESSAGE, 'c');
                startActivity(intent);
                // C Gebäude
                break;
            case R.id.k_button:
                //K Gebäude
                intent = new Intent(getActivity(), RaumplanShowActivity.class);
                intent.putExtra(EXTRA_MESSAGE, 'k');
                startActivity(intent);
                break;
            case R.id.m_button:
                //Mensa
                intent = new Intent(getActivity(), RaumplanShowActivity.class);
                intent.putExtra(EXTRA_MESSAGE, 'm');
                startActivity(intent);
                break;
            case R.id.s_button:
                //Sporthalle
                intent = new Intent(getActivity(), RaumplanShowActivity.class);
                intent.putExtra(EXTRA_MESSAGE, 's');
                startActivity(intent);
                break;
        }
    }

}
